﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Runtime.Serialization;
using System.Text;

namespace CommunitySystemModel
{
    public class RenQianGongShi
    {
        private int _ID;
        [DataMember]
        public int ID
        {
            get { return _ID; }
            set { _ID = value; }
        }

        private int _PublicOfficialRecordID;
        [DataMember]
        public int PublicOfficialRecordID
        {
            get { return _PublicOfficialRecordID; }
            set { _PublicOfficialRecordID = value; }
        }

        private string _SNian;
        [DataMember]
        public string SNian
        {
            get { return _SNian; }
            set { _SNian = value; }
        }

        private string _SYUe;
        [DataMember]
        public string SYUe
        {
            get { return _SYUe; }
            set { _SYUe = value; }
        }

        private string _SRi;
        [DataMember]
        public string SRi
        {
            get { return _SRi; }
            set { _SRi = value; }
        }

        private string _ENian;
        [DataMember]
        public string ENian
        {
            get { return _ENian; }
            set { _ENian = value; }
        }

        private string _EYue;
        [DataMember]
        public string EYue
        {
            get { return _EYue; }
            set { _EYue = value; }
        }

        private string _ERi;
        [DataMember]
        public string ERi
        {
            get { return _ERi; }
            set { _ERi = value; }
        }

        private string _IsFanYing;
        [DataMember]
        public string IsFanYing
        {
            get { return _IsFanYing; }
            set { _IsFanYing = value; }
        }

        private string _ChuLiQingKuang;
        [DataMember]
        public string ChuLiQingKuang
        {
            get { return _ChuLiQingKuang; }
            set { _ChuLiQingKuang = value; }
        }

        private string _Duty;
        [DataMember]
        public string Duty
        {
            get { return _Duty; }
            set { _Duty = value; }
        }
        private string _Department_Duty;
        [DataMember]
          public string Department_Duty
        {
            get { return _Department_Duty; }
            set { _Department_Duty = value; }
        }
        
        private string _DutyAttribute;
        [DataMember]
            public string DutyAttribute
        {
            get { return _DutyAttribute; }
            set { _DutyAttribute = value; }
        }
        private string _EmpName;
        [DataMember]
        public string EmpName
        {
            get { return _EmpName; }
            set { _EmpName = value; }
        }
        private bool _IsShenQingZhuanRen;
        [DataMember]
        public bool IsShenQingZhuanRen
        {
            get { return _IsShenQingZhuanRen; }
            set { _IsShenQingZhuanRen = value; }
        }
        private bool _IsZhuanRen;
        [DataMember]
        public bool IsZhuanRen
        {
            get { return _IsZhuanRen; }
            set { _IsZhuanRen = value; }
        }
        private int _Sec;
        [DataMember]
        public int Sec
        {
            get { return _Sec; }
            set { _Sec = value; }
        }

        private DateTime? _StartDate;
        [DataMember]
        public DateTime? StartDate
        {
            get { return _StartDate; }
            set { _StartDate = value; }
        }
        private DateTime? _EndDate;
        [DataMember]
        public DateTime? EndDate
        {
            get { return _EndDate; }
            set { _EndDate = value; }
        }
        private string _ISTongyi;
        [DataMember]
         public string ISTongyi
        {
            get { return _ISTongyi; }
            set { _ISTongyi = value; }
        }
        private string _FYQk;
        [DataMember]
        public string FYQk
        {
            get { return _FYQk; }
            set { _FYQk = value; }
        }
        public static RenQianGongShi FillEntity(DataRow dr)
        {
            RenQianGongShi right = new RenQianGongShi();
            if (dr.Table != null && dr.Table.Columns.Contains("Sec")) right.Sec = Convert.ToInt32(dr["Sec"]);
            if (!string.IsNullOrEmpty(dr["ID"].ToString())) right.ID = Convert.ToInt32(dr["ID"]);
            if (!string.IsNullOrEmpty(dr["PublicOfficialRecordID"].ToString())) right.PublicOfficialRecordID = Convert.ToInt32(dr["PublicOfficialRecordID"]);

            right.SNian = dr["SNian"] as string;
            right.SYUe = dr["SYUe"] as string;
            right.SRi = dr["SRi"] as string;
            right.ENian = dr["ENian"] as string;
            right.EYue = dr["EYue"] as string;
            right.ERi = dr["ERi"] as string;
            right.IsFanYing = dr["IsFanYing"] as string;
            right.ChuLiQingKuang = dr["ChuLiQingKuang"] as string;
            right.Duty = dr["Duty"] as string;
            right.Department_Duty = dr["Department_Duty"] as string;
            right.DutyAttribute = dr["DutyAttribute"] as string;
            right.EmpName = dr["EmpName"] as string;
            if (dr.Table != null && dr.Table.Columns.Contains("IsShenQingZhuanRen"))
                if (!string.IsNullOrEmpty(dr["IsShenQingZhuanRen"].ToString()))
                    right.IsShenQingZhuanRen = Convert.ToBoolean(dr["IsShenQingZhuanRen"]);
            if (dr.Table != null && dr.Table.Columns.Contains("IsZhuanRen"))
                if (!string.IsNullOrEmpty(dr["IsZhuanRen"].ToString()))
                    right.IsZhuanRen = Convert.ToBoolean(dr["IsZhuanRen"]);

            if (!string.IsNullOrEmpty(dr["StartDate"].ToString()))
                right.StartDate = Convert.ToDateTime(dr["StartDate"]);

            if (!string.IsNullOrEmpty(dr["EndDate"].ToString()))
                right.EndDate = Convert.ToDateTime(dr["EndDate"]);

            right.ISTongyi = dr["ISTongyi"] as string;
            right.FYQk = dr["FYQk"] as string;
            return right;
        }
    }
}
